---
--类名: MapSiteView.lua
--创建日期: 2016-12-7
--创建人: 陈小虎
--功能描述: 
--修改内容:
--修改日期:   
--修改人:     
--修改备注: 
--

local MapSiteView = class("MapSiteView",function()
    return display.newLayer()
end)

function MapSiteView:ctor(mapId)
    --ui根节点
    self.mUINode = cc.uiloader:load(Res.mapNameScene)
    self:addChild(self.mUINode)
    self.mUINode:setContentSize(cc.size(display.width,display.height))
    ccui.Helper:doLayout(self.mUINode)
    display.setCascadeOpacityEnabled(self.mUINode,true)

    local mapConfig = GD:queryMapById(mapId)
    local name = ""
    if mapConfig and mapConfig.string then
    	name = L(mapConfig.string)
    end
    local panel = self.mUINode:getChildByName("Panel")
    panel:setSwallowTouches(false)
    local nameNode = panel:getChildByName("Text_2")
    nameNode:setString(name)

    self:playUIAction()
end

function MapSiteView:playUIAction()
    local timeline = self.mUINode:getTimeline()
	timeline:gotoFrameAndPlay(0, false)
	timeline:setLastFrameCallFunc(function()
        self:removeFromParent()
    end)
end

return MapSiteView